import type { SunnyMailConf } from "@/types/sunnyMailConf/type";
import { defineStore } from "pinia";
import { computed, ref } from "vue";
export const useMailConfStore = defineStore("mailConf", () => {
  const selectedMailConf = ref<SunnyMailConf>({
    id: 0,
    name: "未命名配置",
    smtpServer: "",
    smtpPort: 465,
    senderNickname: "roy",
    mailPassword: "",
    mailAccount: "",
    receiverList: "",
    copyList: "",
    companyName: "特斯汀学院",
    mailTitle: "",
  });

  const nowStep = ref(0);

  const cascaderValues = ref<number[]>([]);

  const resultId = computed(() => {
    if (cascaderValues.value.length === 0) {
      return -1;
    } else {
      return cascaderValues.value[1];
    }
  });

  return { selectedMailConf, nowStep, cascaderValues, resultId };
});
